package com.mooc.yohoshop.ui.order;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mooc.yohoshop.R;
import com.mooc.yohoshop.entity.OrderEntity;
import com.mooc.yohoshop.imgload.ImageLoad;

import org.jetbrains.annotations.NotNull;

public class OrderAdapter extends BaseQuickAdapter<OrderEntity.OrderGoodsValues, BaseViewHolder> {

    public OrderAdapter() {
        super(R.layout.item_order);
        addChildClickViewIds(R.id.order_item_convert);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, OrderEntity.OrderGoodsValues orderGoodsValues) {
        ImageLoad.loadMatchUrl(orderGoodsValues.car_path,baseViewHolder.getView(R.id.order_item_img));
        baseViewHolder.setText(R.id.order_item_num,"X"+orderGoodsValues.shop_num);
        baseViewHolder.setText(R.id.order_item_title,orderGoodsValues.shop_name);
        baseViewHolder.setText(R.id.order_item_statues,orderGoodsValues.statue);
        baseViewHolder.setText(R.id.order_item_price, "¥"+orderGoodsValues.shop_price);
        baseViewHolder.setVisible(R.id.order_item_convert,false);
        if (orderGoodsValues.statue.equals("待收货")){
            baseViewHolder.setVisible(R.id.order_item_convert,true);
            baseViewHolder.setText(R.id.order_item_convert,"确认收货");
        }
    }
}
